---
title: 'Authentication'
description: "Authenticate with Langbase to deploy your AI agents and memory."
tags:
    - baseai
    - auth
    - langbase
section: 'Deployment'
published: 2024-09-24
modified: 2024-09-24
---

# Authentication

Langbase creates a secure environment for your AI agents and memory. To deploy your AI agents and memory, you need to authenticate with Langbase.

---

## Step #0 Create an account

Make sure you have an account on [Langbase](https://langbase.com).

## Step #1 Authenticate with Langbase

To authenticate with Langbase, run this:

```bash
npx baseai@latest auth
```

It will ask your permission to open a browser window to authenticate with Langbase. Make sure you are logged in to your Langbase account.

## Step #2 Generate API Key

Select the account you want to authenticate with Langbase and click on 'Generate API Key' to authenticate. It
will generate an API key for you.

<Img
	light="/deploy/auth-api-light.jpg"
	dark="/deploy/auth-api-dark.jpg"
	alt="⌘ Langbase Authentication BaseAI"
	caption="⌘ Langbase Authentication BaseAI"
/>


## Step #3 Paste API Key

Copy that API key and paste it in the terminal.

This will save your API key in your local `.env` as `LANGBASE_API_KEY` file. And in the OS config file of BaseAI.

That's it! You are now authenticated with Langbase. You can now deploy your AI agents and memory to Langbase.
